{% if gpu | default(false) %}
    {%- set cfg = docker.daemon | combine({'data-root': docker.datadir | default('/var/lib/docker')}) | combine({'default-runtime': 'nvidia'} , recursive=True) | combine({'runtimes': {'nvidia': {'path': '/usr/bin/nvidia-container-runtime', 'runtimeArgs':[]}}} , recursive=True) %}
{% else %}
    {%- set cfg = docker.daemon | combine({'data-root': docker.datadir | default('/var/lib/docker')}) %}
{% endif %}
{% if REGISTRY_URL is defined %}
    {%- if REGISTRY_URL | urlsplit('port') is not none %}
        {%- set host = [  ] %}
        {%- set _ = host.append("%s:%s" % (REGISTRY_URL | urlsplit('hostname'), REGISTRY_URL | urlsplit('port'))) %}
        {%- set cfg = cfg | combine({'insecure-registries': host }, recursive=True, list_merge="append") %}
    {%- else %}
        {%- set cfg = cfg | combine({'insecure-registries': [ REGISTRY_URL | urlsplit('hostname') ]}, recursive=True, list_merge="append") %}
    {%- endif %}
{%- endif %}
{{ cfg | to_nice_json }}